//
//  CellOfOnePic.m
//  ProjectA_ManualGuest
//
//  Created by dingcong on 16/6/14.
//  Copyright © 2016年 丁聪. All rights reserved.
//

#import "CellOfOnePic.h"
#import "Masonry.h"
#import "UIImageView+WebCache.h"
@implementation CellOfOnePic

- (void)dealloc
{
    [_lable release];
    [_Pic release];
    [_model release];
    [_strtype release];
    [_strid release];
   
    [super dealloc];
    
    
    
    
}



- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier])
    {
        [self creat];
        self.backgroundColor = [UIColor clearColor];
    }
    return self;
    
}

- (void)creat
{
    
    self.Pic = [[UIImageView alloc]init];
    [self.contentView addSubview:self.Pic];
   
    [self.Pic mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.leading.equalTo(self.contentView.mas_leading).offset(0);
        make.top.equalTo(self.contentView.mas_top).offset(5);
        make.width.equalTo(self.contentView.mas_width);
        make.bottom.equalTo(self.contentView.mas_bottom).offset(-3);
        
        
    }];
    
    
//    self.Pic.backgroundColor = [UIColor cyanColor];
    [self.Pic release];
    
    
    
    self.lable = [[UILabel alloc]init];
    [self.contentView addSubview:self.lable];
    [self.lable mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.leading.equalTo(self.contentView.mas_leading).offset(9);
        make.centerY.equalTo(self.Pic.mas_centerY).offset(0);
        make.height.offset(27);
        make.width.offset(SCREEN_WIDTH - 25);
        
    }];
//    self.lable.backgroundColor = [UIColor yellowColor];
    self.lable.textColor = [UIColor whiteColor];
    self.lable.textAlignment = NSTextAlignmentCenter;
    [self.lable release];
    
}

- (void)setModel:(SelectionModel *)model
{
    [self.Pic sd_setImageWithURL:[NSURL URLWithString:model.pic] placeholderImage:[UIImage imageNamed:@"13.png"]];
    
    self.lable.text = model.subject;
    self.lable.font = [UIFont systemFontOfSize:16.5];
    self.strid = model.topic_id;
    self.strtype = model.topic_type;
//    NSLog(@".........%@%@",self.strid, self.strtype);
    
    
}

- (void)setNewModel:(NewModel *)NewModel{
    
    NSLog(@"%@", NewModel.pic);
    
    [self.Pic sd_setImageWithURL:[NSURL URLWithString:NewModel.pic] placeholderImage:nil];
    
    self.lable.text = NewModel.subject;
}


@end
